package main

import "fmt"

func slowestKey(releaseTimes []int, keysPressed string) byte {
	maxC := keysPressed[0]
	max := releaseTimes[0]
	for i := 1; i < len(releaseTimes); i++ {
		m := releaseTimes[i] - releaseTimes[i-1]
		if m > max || (m == max && keysPressed[i] > maxC) {
			maxC = keysPressed[i]
			max = m
		}
	}
	return maxC
}

func main() {
	fmt.Println(slowestKey([]int{9, 29, 49, 50}, "cbcd"))
}
